package com.csu.bailan.service;

import com.csu.bailan.common.CommonResponse;

import com.csu.bailan.domain.Address;
import com.csu.bailan.domain.Signon;
import com.csu.bailan.domain.User;
import com.csu.bailan.dto.AddrDTO;
import com.csu.bailan.dto.UpdateUserDTO;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface UserService {
    // 根据用户名获取用户
    public User getUserByUsername(String username);
    // 根据用户名和密码获取用户
    public CommonResponse<User> getUserByUNandPW(String username, String password) throws Exception;
    // 根据昵称获取用户
    public User getUserByNickname(String nickname);
    // 创建新用户
    public CommonResponse<User> createUser(User user, Signon signon) throws Exception;
    // 根据用户ID删除用户
    public CommonResponse<User> deleteUserByUserid(String userId);
    // 根据用户名删除用户
    public CommonResponse<User> deleteUserByUsername(String username);
    // 更新用户信息
    public CommonResponse<User> updateUserInfo(UpdateUserDTO updateUserDTO);
    // 更新密码
    public CommonResponse<User> updatePassword(String username, String newpasswd1, String newpassword2) throws Exception;
    public CommonResponse<User> updatePassword(User user, String newpasswd1, String newpassword2) throws Exception;
    // 根据用户id获取地址信息
    public CommonResponse<List<Address>> getAddrByUserid(String userId);
    // 更新地址
    public CommonResponse<Address> updateAddr(AddrDTO addrDTO);
    // 新建地址
    public CommonResponse<Address> newAddr(AddrDTO addrDTO);
}
